﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace db_proto
{
    public partial class MainPage : Form
    {
        public MainPage()
        {
            InitializeComponent();
        }

        private void MainPage_Load(object sender, EventArgs e)
        {
            LoginPage lp = new LoginPage(this);
            lp.ShowDialog();

            this.Hide();
            this.IsMdiContainer = true;
        }

        private void testToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SqlConnection c = SqlService.getInstance().getConnection();

            SqlCommand cmd = new SqlCommand();
            cmd.Connection = c;
            cmd.CommandText = "select value from Colors;";
            SqlDataAdapter da = new SqlDataAdapter();
            da.SelectCommand = cmd;


            DataSet ds = new DataSet();
            da.Fill(ds);

            grid g = new grid();

            
           g.setDatasource(ds);
            g.Show();
        }

        private void salonyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            salon salonyd = new salon();
            salonyd.Show();
            SqlConnection c = SqlService.getInstance().getConnection();

            SqlCommand cmd = new SqlCommand();
            cmd.Connection = c;
            cmd.CommandText = "select id from Salon;";
            SqlDataAdapter da = new SqlDataAdapter();
            da.SelectCommand = cmd;


            DataSet ds = new DataSet();
            da.Fill(ds);

            grid salont = new grid();


            salont.setDatasource(ds);
            salont.Show();
           
            
        }

        private void clientToolStripMenuItem_Click(object sender, EventArgs e)
        {
            claient cl = new claient();
            cl.Show();
        }
    }
}
